package com.lyf.beans.entity;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;

/**
 * @AUTHOR LYF
 * @DATE 2022/5/13
 * @VERSION 1.0
 * @DESC
 */
public class Person implements InitializingBean, DisposableBean {
    @Value("${person.name}")
    String name;
    Integer age;

    public Person() {
    }

    public Person(String name, Integer age) {
        System.out.println("----constructor....");
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("----destroy");
    }

    @Override
    public void afterPropertiesSet() throws Exception {

        // 测试获取---IOC容器
        System.out.println("require  IOC container....");




        System.out.println("----afterPropertiesSet");
    }
}
